package br.fbv.compreja.activity.produto;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import br.fbv.compreja.activity.base.Util;

public class ProdutoImageAdapter extends BaseAdapter {

	private Context context;
	private List<ImageView> pictures;

	public ProdutoImageAdapter(Context context, List<String> picturesURLs) {
		super();
		this.context = context;
		this.pictures = new ArrayList<ImageView>();
		for (String url : picturesURLs) {
			ImageView imageView = new ImageView(this.context);
			imageView.setImageDrawable(Util.loadImageFromWebOperations(url));
			pictures.add(imageView);
		}
	}

	@Override
	public int getCount() {
		return pictures.size();
	}

	@Override
	public Object getItem(int arg0) {
		return pictures.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		return pictures.get(position);

	}
}
